package de.unimannheim.ki.databaseentities;

import java.io.Serializable;
import javax.persistence.*;

import java.util.List;


/**
 * The persistent class for the musicuser database table.
 * 
 */
@Entity(name="Musicuser")
public class Musicuser implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String fbid;

	private int age;

	private String firstname;

	private String lastfmid;

	private String name;

	@OneToMany(mappedBy="musicuser", cascade=CascadeType.PERSIST)
	private List<UserEvaluation> evaluations;
	
	
	//bi-directional many-to-many association to Object
	@ManyToMany (cascade=CascadeType.PERSIST, fetch=FetchType.EAGER) 
	@JoinTable(
		name="likes"
		, joinColumns={
			@JoinColumn(name="FBID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="ObjectID")
			}
		)
	private List<MusicObject> musicobjects;

	//bi-directional many-to-many association to Song
	@ManyToMany (cascade= CascadeType.PERSIST)
	@JoinTable(
		name="plays"
		, joinColumns={
			@JoinColumn(name="UserID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="SongID")
			}
		)
	private List<Song> songs;

	public Musicuser() {
	}

	public String getFbid() {
		return this.fbid;
	}

	public void setFbid(String fbid) {
		this.fbid = fbid;
	}

	public int getAge() {
		return this.age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getFirstname() {
		return this.firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastfmid() {
		return this.lastfmid;
	}

	public void setLastfmid(String lastfmid) {
		this.lastfmid = lastfmid;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<MusicObject> getObjects() {
		return this.musicobjects;
	}

	public void setObjects(List<MusicObject> objects) {
		this.musicobjects = objects;
	}

	public List<Song> getSongs() {
		return this.songs;
	}

	public void setSongs(List<Song> songs) {
		this.songs = songs;
	}

	public List<UserEvaluation> getEvaluations() {
		return evaluations;
	}

	public void setEvaluations(List<UserEvaluation> evaluations) {
		this.evaluations = evaluations;
	}

}